#pragma once
#include<locale.h>
#include<stdlib.h>
#include<time.h>
#include<stdio.h>
#include<windows.h>
#include<stdbool.h>
#define POS_X 24
#define POS_Y 5
#define KEY_PRESS(VK) ((GetAsyncKeyState(VK)&0x1)?1:0)
typedef struct snakenode
{
	int x;
	int y;
	struct snakenode* next;
}snakenode;

enum DIRECTION
{
	UP = 1,
	DOWN,
	LEFT,
	RIGHT
};

enum GAME_STATUS
{
	OK,
	KILL_BY_WALL,
	KILL_BY_SELF,
	END_NOMAL
};
typedef struct snake
{
	snakenode* phead;
	snakenode* pfood;
	enum DIRECTION dir;
	enum GAME_STATUS status;
	int score;
	int foodweight;
	int sleeptime;
}snake;


void SetPos(short x, short y);

void WelcomeToGame();

void CreatMap();

void InitSnake(snake* ps);


void CreateFood(snake* ps);

void printfhelinfo();

void pause();

void snakemove(snake* ps);

void killbywall(snake* ps);

void killbyself(snake* ps);

void GameEnd(snake* ps);
